from enum import Enum

class EET(Enum):
    FETCH_ORDER_BOOK_ERROR = "Error fetching order book"
    FETCH_BALANCE_ERROR = "Error fetching account balance"
    FETCH_OHLCV_ERROR = "Error fetching OHLCV data"
    SELL_BUY_ERROR = "Error in sell_buy operation"
    BAD_CONDITIONS = "Bad conditions for trade"
    INSUFFICIENT_FUNDS = "Insufficient funds for the operation"
    BAD_API_KEYS="Bad API keys"
    UNKNOWN="Unknown error"

class ExchangeError(Exception):
    def __init__(self, error_type: EET, custom_message=None):
        self.error_type = error_type
        self.custom_message = custom_message
        if self.custom_message is None:
            self.message = error_type.value
        else:
            self.message = self.custom_message
        super().__init__(self.message)
